********************************************************************
* Date: 				17 August 2020
* Authors: 				N. Karouzakis & K. Tzioumis
* Paper title: 			Spillover costs of national security policies
* Program's purpose: 	To produce Table OA.1 - Panel data (random effects) regression results

	set more off


********************************************************************
* Upload dataset
	use "C:\Table_OA1_Data.dta", clear 
	tsset _countryofcitizenship year
	
	
********************************************************************
* Create a variable that will be used in excluding the ten Muslim-majority Middle Eastern countries from the estimation sample in Column 2
	gen exclude=1 if region=="Middle East" & muslim_majority==1	
	
	
********************************************************************
* Create an interaction term because the XTOVERID test produces the message "0b: operator invalid" when using the ## for factor variables
	gen interaction = muslim_majority * ban
	
	
********************************************************************
* Results for Table 2, Column 1 (With the Muslim-majority Middle Eastern countries)
	xtreg lntourists  i.muslim_majority##i.ban lnGDPperCapita lnpopulation lndistwces comlang_ethno				 , re cluster(country)
			outreg2 using "C:\Table_2", excel tdec(3) bdec(3) addstat(R2 overall, `e(r2_o)') ctitle("Five regions with Middle East") 
			* Robust Hausman-type test for FE vs. RE model
				qui xtreg lntourists  muslim_majority ban interaction lnGDPperCapita lnpopulation lndistwces comlang_ethno 			    , re cluster(country)
				xtoverid
			
			
********************************************************************
* Results for Table 2, Column 2  (Without the Muslim-majority Middle Eastern countries)
	xtreg lntourists  i.muslim_majority##i.ban lnGDPperCapita lnpopulation lndistwces comlang_ethno if exclude~=1, re cluster(country)
			outreg2 using "C:\Table_2", excel tdec(3) bdec(3) addstat(R2 overall, `e(r2_o)') ctitle("Five regions without Middle East") append
			* Robust Hausman-type test for FE vs. RE model
				qui xtreg lntourists  muslim_majority ban interaction lnGDPperCapita lnpopulation lndistwces comlang_ethno if exclude~=1 , re cluster(country)
				xtoverid	
